import sys

text = ''
with open(sys.argv[1], 'rb') as f:
    data = f.read()
    text = data.decode('utf-8')

map = {}
for c in text:
    d = bytes(c, 'utf-8')
    if str.isspace(c) or len(d) < 2:
        print('ignore: ', d)
        continue
    if c not in map:
        map[c] = 1
    else:
        map[c] += 1

out = ''
for c, n in enumerate(map):
    print(c, n)
    out = out + n

print(out)
